/*
 * Hyuga: A Density-Grid Stream Clustering Platform.
 * Copyright (C) 2014 PUC-Rio/Laboratory for Advanced Collaboration
 *
 * Hyuga is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Hyuga is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Hyuga.  If not, see <http://www.gnu.org/licenses/>.
 */
package br.pucrio.inf.lac.konoha.hyuga.events.cell;

import java.util.Collection;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import br.pucrio.inf.lac.konoha.hyuga.events.CEPEvent;
import br.pucrio.inf.lac.konoha.hyuga.events.LocationUpdateEvent;

/**
 * Represent a transient context partition (cell) event. That is, this cell density is within the minminPts and minPts 
 * range, thus, due to the blind spot issue we will use a decay function to inspect its neighboring content.
 *  
 * @author Marcos Roriz <mroriz@inf.puc-rio.br>
 */
public class CellTransientEvent {
    // Cell Identifiers
    protected int x;
    protected int y;
    
    // Mobile Nodes
    protected LocationUpdateEvent[] nodes;
    
    // Empty Constructor
    public CellTransientEvent() {}

    // Array Constructor
    public CellTransientEvent(int x, int y, LocationUpdateEvent[] nodes) {
        this.x     = x;
        this.y     = y;
        this.nodes = nodes;
    }
    
    /**
     * Retrieve the number of mobile nodes in the cell, using their UUID (from {@link LocationUpdateEvent}) in the cell.
     * 
     * @return the number of mobile nodes in the cell, 0 if nodes is null.
     */
    public int size() {
        if (nodes != null) return nodes.length;
        else return 0;
    }
    
    @Override
    public String toString() {
        int size = 0;
        if (nodes != null) size = nodes.length;
        
        return "(" + x + ", " + y + ") ~ " + size;
    }

    //////////////////////////////////////////////////////////////////////////
    // Gets and Sets
    //////////////////////////////////////////////////////////////////////////

    public LocationUpdateEvent[] getNodes() {
        return nodes;
    }
    
    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public void setNodes(LocationUpdateEvent[] nodes) {
        this.nodes = nodes;
    }
    
    public void setX(int x) {
        this.x = x;
    }

    public void setY(int y) {
        this.y = y;
    }

}
